From: Florian Müllner Date: Sun, 26 Feb 2017 21:23:11 +0000 (+0100) Subject: messageList: Make canClear public and notify on changes X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~502 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=239b67eff62c46f079502f33523a0eafccd2dfc9;p=gnome-shell.git messageList: Make canClear public and notify on changes The latest mockups contain a button to clear all sections at once. As some elements cannot be cleared, we need to provide that information to avoid offering an action that has no effect. https://bugzilla.gnome.org/show_bug.cgi?id=775763 --- diff --git a/js/ui/messageList.js b/js/ui/messageList.js index 325f5a370..9dde30941 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -563,6 +563,7 @@ const MessageListSection = new Lang.Class({ this._messages = new Map(); this._date = new Date(); this.empty = true; + this.canClear = false; this._sync(); }, @@ -719,7 +720,14 @@ const MessageListSection = new Lang.Class({ if (changed) this.emit('empty-changed'); - this._closeButton.visible = this._canClear(); + let canClear = this._canClear(); + changed = this.canClear !== canClear; + this.canClear = canClear; + + if (changed) + this.emit('can-clear-changed'); + + this._closeButton.visible = this.canClear; this.actor.visible = this.allowed && this._shouldShow(); } });